using FlatRedBall.ManagedSpriteGroups;
using Microsoft.Xna.Framework;
using FlatRedBall;
using FlatRedBall.Graphics;
using Microsoft.Xna.Framework.Graphics;
using RobotVsZombies.Screens;
using Rvz.Game.Main.State;

namespace Rvz.Game.Main
{
    public class Demo : RvzGameBase
    {
        private GameState _gameState;
        private readonly string _contentManagerName = string.Empty;

        protected override void Initialize()
        {
            Renderer.UseRenderTargets = false;
            FlatRedBallServices.InitializeFlatRedBall(this, Graphics);

            _gameState = new GameState(Graphics, _contentManagerName);

            //TODO: CleanUp
            var tile = new Sprite { Texture = FlatRedBallServices.Load<Texture2D>("Content\\Entities\\Terrain\\grass-tile1.png") };
            var spriteGrid = new SpriteGrid(SpriteManager.Camera, SpriteGrid.Plane.XY, tile)
                                 {
                                     XLeftBound = -25,
                                     XRightBound = 25,
                                     YTopBound = 20,
                                     YBottomBound = -20
                                 };
            spriteGrid.PopulateGrid();
            spriteGrid.Z = -1;

            base.Initialize();
        }

        protected override void Update(GameTime gameTime)
        {
            FlatRedBallServices.Update(gameTime);
            ScreenManager.Activity();
            
            _gameState.Update(gameTime);
            
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            FlatRedBallServices.Draw();

            base.Draw(gameTime);
        }
    }
}
